
package com.thor.palmmall.rest.hdmall.user.converter;

import org.springframework.core.convert.converter.Converter;

import com.thor.palmmall.hdmall.user.HDMUser;
import com.thor.palmmall.rest.hdmall.user.MUser;

/**
 * @author:liyang
 * @time:2017年7月25日 下午4:15:26
 * @since:1.0
 */
public class MUserConverter implements Converter<HDMUser, MUser> {

  public static MUserConverter getInstance() {
    if (instance == null)
      instance = new MUserConverter();
    return instance;
  }

  private static MUserConverter instance;

  private MUserConverter() {
  }

  @Override
  public MUser convert(HDMUser source) {
    if (source == null)
      return null;

    MUser target = new MUser();
    target.setCode(source.getCode());
    target.setName(source.getName());
    target.setUuid(source.getUuid());
    target.setType(source.getType());
    target.setTelephone(source.getTelephone());
    target.setTenant(source.getTenant());
    target.setStore(source.getStore());
    target.setContracts(source.getContracts());
    target.setPermissions(source.getPermissions());
    return target;
  }
}
